using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class QuestionInfo
    {
		#region Local Variable
		public enum Field
		{
			ID,
			Description,
			Explanation,
			Type,
			Difficulty,
			Rate,
			Timer,
			Picture,
			Sound,
			Enabled,
			ANAL_Q0,
			ANAL_Q1,
			ANAL_Q2,
			ANAL_Q3,
			ANAL_Q4,
			ANAL_Q5,
			ANAL_Q6,
			ANAL_Q7,
			ANAL_Q8,
			ANAL_Q9
		}
		private Int64 _ID;
		private String _Description;
		private String _Explanation;
		private String _Type;
		private Int32 _Difficulty;
		private Double _Rate;
		private Int32 _Timer;
		private String _Picture;
		private String _Sound;
		private Boolean _Enabled;
		private String _ANAL_Q0;
		private String _ANAL_Q1;
		private String _ANAL_Q2;
		private String _ANAL_Q3;
		private String _ANAL_Q4;
		private String _ANAL_Q5;
		private String _ANAL_Q6;
		private String _ANAL_Q7;
		private String _ANAL_Q8;
		private String _ANAL_Q9;
		
		public Int64 ID{	get{ return _ID;} set{_ID = value;} }
		public String Description{	get{ return _Description;} set{_Description = value;} }
		public String Explanation{	get{ return _Explanation;} set{_Explanation = value;} }
		public String Type{	get{ return _Type;} set{_Type = value;} }
		public Int32 Difficulty{	get{ return _Difficulty;} set{_Difficulty = value;} }
		public Double Rate{	get{ return _Rate;} set{_Rate = value;} }
		public Int32 Timer{	get{ return _Timer;} set{_Timer = value;} }
		public String Picture{	get{ return _Picture;} set{_Picture = value;} }
		public String Sound{	get{ return _Sound;} set{_Sound = value;} }
		public Boolean Enabled{	get{ return _Enabled;} set{_Enabled = value;} }
		public String ANAL_Q0{	get{ return _ANAL_Q0;} set{_ANAL_Q0 = value;} }
		public String ANAL_Q1{	get{ return _ANAL_Q1;} set{_ANAL_Q1 = value;} }
		public String ANAL_Q2{	get{ return _ANAL_Q2;} set{_ANAL_Q2 = value;} }
		public String ANAL_Q3{	get{ return _ANAL_Q3;} set{_ANAL_Q3 = value;} }
		public String ANAL_Q4{	get{ return _ANAL_Q4;} set{_ANAL_Q4 = value;} }
		public String ANAL_Q5{	get{ return _ANAL_Q5;} set{_ANAL_Q5 = value;} }
		public String ANAL_Q6{	get{ return _ANAL_Q6;} set{_ANAL_Q6 = value;} }
		public String ANAL_Q7{	get{ return _ANAL_Q7;} set{_ANAL_Q7 = value;} }
		public String ANAL_Q8{	get{ return _ANAL_Q8;} set{_ANAL_Q8 = value;} }
		public String ANAL_Q9{	get{ return _ANAL_Q9;} set{_ANAL_Q9 = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public QuestionInfo()
		{
			_ID = 0;
			_Description = "";
			_Explanation = "";
			_Type = "";
			_Difficulty = 0;
			_Rate = 0;
			_Timer = 0;
			_Picture = "";
			_Sound = "";
			_Enabled = true;
			_ANAL_Q0 = "";
			_ANAL_Q1 = "";
			_ANAL_Q2 = "";
			_ANAL_Q3 = "";
			_ANAL_Q4 = "";
			_ANAL_Q5 = "";
			_ANAL_Q6 = "";
			_ANAL_Q7 = "";
			_ANAL_Q8 = "";
			_ANAL_Q9 = "";
		}
		public QuestionInfo(
		Int64 ID,
		String Description,
		String Explanation,
		String Type,
		Int32 Difficulty,
		Double Rate,
		Int32 Timer,
		String Picture,
		String Sound,
		Boolean Enabled,
		String ANAL_Q0,
		String ANAL_Q1,
		String ANAL_Q2,
		String ANAL_Q3,
		String ANAL_Q4,
		String ANAL_Q5,
		String ANAL_Q6,
		String ANAL_Q7,
		String ANAL_Q8,
		String ANAL_Q9
		)
		{
			_ID = ID;
			_Description = Description;
			_Explanation = Explanation;
			_Type = Type;
			_Difficulty = Difficulty;
			_Rate = Rate;
			_Timer = Timer;
			_Picture = Picture;
			_Sound = Sound;
			_Enabled = Enabled;
			_ANAL_Q0 = ANAL_Q0;
			_ANAL_Q1 = ANAL_Q1;
			_ANAL_Q2 = ANAL_Q2;
			_ANAL_Q3 = ANAL_Q3;
			_ANAL_Q4 = ANAL_Q4;
			_ANAL_Q5 = ANAL_Q5;
			_ANAL_Q6 = ANAL_Q6;
			_ANAL_Q7 = ANAL_Q7;
			_ANAL_Q8 = ANAL_Q8;
			_ANAL_Q9 = ANAL_Q9;
		}
		public QuestionInfo(DataRow dr)
		{
			if (dr != null)
			{
				_ID = dr[Field.ID.ToString()] == DBNull.Value?0:Convert.ToInt64(dr[Field.ID.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Explanation = dr[Field.Explanation.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Explanation.ToString()]);
				_Type = dr[Field.Type.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Type.ToString()]);
				_Difficulty = dr[Field.Difficulty.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.Difficulty.ToString()]);
				_Rate = dr[Field.Rate.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.Rate.ToString()]);
				_Timer = dr[Field.Timer.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.Timer.ToString()]);
				_Picture = dr[Field.Picture.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Picture.ToString()]);
				_Sound = dr[Field.Sound.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Sound.ToString()]);
				_Enabled = dr[Field.Enabled.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.Enabled.ToString()]);
				_ANAL_Q0 = dr[Field.ANAL_Q0.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q0.ToString()]);
				_ANAL_Q1 = dr[Field.ANAL_Q1.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q1.ToString()]);
				_ANAL_Q2 = dr[Field.ANAL_Q2.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q2.ToString()]);
				_ANAL_Q3 = dr[Field.ANAL_Q3.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q3.ToString()]);
				_ANAL_Q4 = dr[Field.ANAL_Q4.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q4.ToString()]);
				_ANAL_Q5 = dr[Field.ANAL_Q5.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q5.ToString()]);
				_ANAL_Q6 = dr[Field.ANAL_Q6.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q6.ToString()]);
				_ANAL_Q7 = dr[Field.ANAL_Q7.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q7.ToString()]);
				_ANAL_Q8 = dr[Field.ANAL_Q8.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q8.ToString()]);
				_ANAL_Q9 = dr[Field.ANAL_Q9.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_Q9.ToString()]);
			}
		}
		public QuestionInfo(QuestionInfo objEntr)
		{			
			_ID = objEntr.ID;			
			_Description = objEntr.Description;			
			_Explanation = objEntr.Explanation;			
			_Type = objEntr.Type;			
			_Difficulty = objEntr.Difficulty;			
			_Rate = objEntr.Rate;			
			_Timer = objEntr.Timer;			
			_Picture = objEntr.Picture;			
			_Sound = objEntr.Sound;			
			_Enabled = objEntr.Enabled;			
			_ANAL_Q0 = objEntr.ANAL_Q0;			
			_ANAL_Q1 = objEntr.ANAL_Q1;			
			_ANAL_Q2 = objEntr.ANAL_Q2;			
			_ANAL_Q3 = objEntr.ANAL_Q3;			
			_ANAL_Q4 = objEntr.ANAL_Q4;			
			_ANAL_Q5 = objEntr.ANAL_Q5;			
			_ANAL_Q6 = objEntr.ANAL_Q6;			
			_ANAL_Q7 = objEntr.ANAL_Q7;			
			_ANAL_Q8 = objEntr.ANAL_Q8;			
			_ANAL_Q9 = objEntr.ANAL_Q9;			
		}
        #endregion Constructor
        
        #region InitTable
		public DataTable ToDataTable()
		{
			DataTable dt = new DataTable("Question");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.ID.ToString(), typeof(Int64)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.Explanation.ToString(), typeof(String)),
				new DataColumn(Field.Type.ToString(), typeof(String)),
				new DataColumn(Field.Difficulty.ToString(), typeof(Int32)),
				new DataColumn(Field.Rate.ToString(), typeof(Double)),
				new DataColumn(Field.Timer.ToString(), typeof(Int32)),
				new DataColumn(Field.Picture.ToString(), typeof(String)),
				new DataColumn(Field.Sound.ToString(), typeof(String)),
				new DataColumn(Field.Enabled.ToString(), typeof(Boolean)),
				new DataColumn(Field.ANAL_Q0.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q1.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q2.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q3.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q4.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q5.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q6.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q7.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q8.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_Q9.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.ID.ToString()] = _ID;
			row[Field.Description.ToString()] = _Description;
			row[Field.Explanation.ToString()] = _Explanation;
			row[Field.Type.ToString()] = _Type;
			row[Field.Difficulty.ToString()] = _Difficulty;
			row[Field.Rate.ToString()] = _Rate;
			row[Field.Timer.ToString()] = _Timer;
			row[Field.Picture.ToString()] = _Picture;
			row[Field.Sound.ToString()] = _Sound;
			row[Field.Enabled.ToString()] = _Enabled;
			row[Field.ANAL_Q0.ToString()] = _ANAL_Q0;
			row[Field.ANAL_Q1.ToString()] = _ANAL_Q1;
			row[Field.ANAL_Q2.ToString()] = _ANAL_Q2;
			row[Field.ANAL_Q3.ToString()] = _ANAL_Q3;
			row[Field.ANAL_Q4.ToString()] = _ANAL_Q4;
			row[Field.ANAL_Q5.ToString()] = _ANAL_Q5;
			row[Field.ANAL_Q6.ToString()] = _ANAL_Q6;
			row[Field.ANAL_Q7.ToString()] = _ANAL_Q7;
			row[Field.ANAL_Q8.ToString()] = _ANAL_Q8;
			row[Field.ANAL_Q9.ToString()] = _ANAL_Q9;
			return row;
		}
        #endregion InitTable
    }
}
